import MySQLdb,time

#connect
conn = MySQLdb.connect(host="localhost", user="root",passwd="root",  db="test")
cursor = conn.cursor()

#insert
#sql = "insert into student (name,`from`,title) values (%s, %s, %s)"
#param = ('aaa', int(time.time()),'fuck')
#n = cursor.execute(sql, param)
#print n

#update
sql = """update student set name=$s where id=1"""
param1 = ('bbb')
n = cursor.execute(sql, )
#print n

n = cursor.execute("select * from student")
for row in cursor.fetchall():
    for r in row:
        print r

max_price = 1
cursor.execute("""SELECT name FROM student WHERE id < %S""",(max_price,))

cursor.close()

conn.close()
